<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<!DOCTYPE html>
<html>
<head>
    <title>地区管理</title>
    <style>
        #page_navigation a {
            padding: 3px;
            border: 1px solid gray;
            margin: 2px;
            color: black;
            text-decoration: none
        }

        .active_page {
            background: darkblue;
            color: white !important;
        }
        #treeTable th{text-align: center}
    </style>

</head>
<body>
<form class="form-horizontal page-header" id="search-form">
    <div class="form-group">
        <label class="col-xs-12 col-sm-1 control-label">名称：</label>

        <div class="col-xs-12 col-sm-3">
            <input type="text" name="name" class="input-large">
        </div>


        <label class="col-xs-12 col-sm-1 control-label">状态：</label>

        <div class="col-xs-12 col-sm-3">
            <select name="status" class="input-large">
                <option value=""></option>
                <c:forEach items="${statusItems}" var="item">
                    <option value="${item.key}">${item.value}</option>
                </c:forEach>
            </select>
        </div>

        <label class="col-xs-12 col-sm-1 control-label"></label>

        <div class="col-xs-12 col-sm-3">
            <button class="btn btn-primary  btn-sm input-btn" type="button" onclick="doSearch()"><i
                    class="ace-icon fa fa-search bigger-120 white"></i>查找
            </button>
        </div>
    </div>
</form>


<div class="row">
    <div class="col-xs-12 custom_tools">
        <div id="indexAlert" class="hide" style="min-width:400px"></div>
        <button class="btn btn-primary  btn-sm" onclick="doAdd(0)"><i class="ace-icon fa fa-plus bigger-120 white"></i>增加
        </button>
    </div>

</div>




<div class="row">
    <div class="col-xs-12">
        <table id="treeTable" class="table table-striped table-bordered table-hover"></table>
    </div>
</div>


<c:import url="../common/validate.jsp"/>
<script type="text/javascript" src="${ctx}/resources/ace/dist/js/bootbox.min.js"></script>
<c:import url="../common/treeTable.jsp"/>
<script type="text/javascript" src="${ctx}/resources/js/module/area/area.js"></script>
<script type="text/javascript">

    $(function (){
        $("#treeTable").treeTable({
            url:"${ctx}/area/list",
            column: 1,
            columns:[
                {field:"name",title:"名称",width:"180",align:"center"},
                {field:"code",title:"编码",align:"center",width:"180"},
                {field:"description",title:"描述",align:"center"},
                {field:"status",title:"状态",align:"center",width:"180",formatter:function (rowData,value){
                    return value==1?"正常":"锁定";
                }},
                {field:"id",title:"操作",width:"220",align:"center",formatter:function(rowData,value){
                    return "<a href='javascript:void(0)' onclick='doEdit("+value+")'><span class='label label-xlg label-purple arrowed-in'>编辑</span></a>" +
                            "<a href='javascript:void(0)' onclick='doDelete("+value+")'><span class='label label-xlg label-warning arrowed-in'>删除</span></a>" +
                            "<a href='javascript:void(0)' onclick='doAdd("+value+")'><span class='label label-xlg label-pink arrowed-in'>添加下级</span></a>";
                }}
            ]
        });
    })
</script>
</body>
</html>
